<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ include file="/taglibs.jsp"%>

<s:url value="/js" var="jsPath" />
<s:url value="/css" var="cssPath" />
<s:url value="/images" var="imgPath" />
<!-- 月历 -->
<script type="text/javascript" charset="UTF-8"
	src="${jsPath}/jquery.datepick.js"></script>
<script type="text/javascript" charset="UTF-8"
	src="${jsPath}/jquery.datepick-zh-CN.js"></script>
<link rel="stylesheet" type="text/css"
	href="${cssPath}/smoothness.datepick.css" />
<script language="javascript">
	var result = "${result}";
	if ("error" == result) {
		alert('此期间有活动不能重复');

	}

	$().ready(
			function() {
				$('#startDate').datepick({
					minDate : null,
					showOn : 'both',
					buttonImageOnly : true,
					buttonImage : '${imgPath}/calendar.gif',
					numberOfMonths : 2,
					dateFormat : "yy-mm-dd",
					yearRange : '-50:+50'
				});
				$('#endDate').datepick({
					minDate : new Date(),
					showOn : 'both',
					buttonImageOnly : true,
					buttonImage : '${imgPath}/calendar.gif',
					numberOfMonths : 2,
					beforeShow : customRange,
					dateFormat : "yy-mm-dd",
					yearRange : '-50:+50'
				});
				function customRange() {
					var startDt = $('#startDate').val(); //起始日
					var endDt = new Date(parseInt(startDt.substring(0, 4), 10),
							parseInt(startDt.substring(5, 7), 10) - 1,
							parseInt(startDt.substring(8, 10), 10)); //結束日
					return {
						minDate : endDt
					};
				}
			});
</script>
<s:actionerror />
<s:actionmessage />
<s:fielderror />
<s:form action="search.do" method="post" id="formObj">
	<s:hidden name="currentPage" />
	<h1>行销活动管理</h1>
	<div class="f-link">
		<a href="add.do">新增</a> <a href="#"
			onclick="document.formObj.submit();">搜寻</a>
	</div>
	<div class="data-form">
		<b>名称关键字：</b>
		<s:textfield name="titleName" />
		<br /> <b>期间：</b> <input name="startDate" id="startDate" size="10">
		<input name="endDate" id="endDate" size="10"><br />
		<!-- 
		<b>
		
		启用：</b>
		<select id="status" ame="status">
<option>全部</option>
<option value="0">是</option>
<option value="1">否</option>
</select>
		 -->
		<br />

	</div>
</s:form>
<br />

<table class="tb-1" width="100%">
	<thead>
		<tr>
			<th>#</th>
			<th>活动名称</th>
			<th>金额</th>
			<th>活动时间</th>
			<th>赠出方式</th>
			<th>启用</th>
			<th>修改启用状态</th>
		</tr>
	</thead>
	<c:forEach items="${promotionOuterList}" var="list" varStatus="i">
		<tbody>
			<tr>
				<td>${i.index+1}</td>
				<td><a href="detailed.do?giftId=${list.id }">
						${list.titleName }</a>
				</td>
				<td>${list.price }</td>
				<td>${list.startDate }~<br />${list.endDate }</td>
				<td><c:if test="${list.sendWay==1 }">随机</c:if> <c:if
						test="${list.sendWay==0 }">全部</c:if></td>
				<td><c:if test="${list.status==1 }">是</c:if> <c:if
						test="${list.status==0 }">否</c:if></td>
				<td><c:if test="${list.status==1 }">
						<a href="updateStart.do?giftId=${list.id }&status=0">不启用</a>
					</c:if> <c:if test="${list.status==0 }">
						<a href="updateStart.do?giftId=${list.id }&status=1">启用</a>
					</c:if></td>
			</tr>

		</tbody>
	</c:forEach>
	<yaodian100:pageutil pagerObj="${pager}"
		link="search.do?titleName=${titleName}&startDate=${startDate}&endDate=${endDate}&status=${status }" />
</table>

<br />
<br />

